package August;

import java.util.Scanner;

public class Day0802 {
    //mp3光标位置
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String s = scanner.next();
        char[] str = s.toCharArray();
        if (n <= 4){
            cursorLow(n,str);
        }else {
            cursorUp(n,str);
        }
    }

    //大于4的方法
    private static void cursorUp(int n,char[] s) {
        //歌曲的起始位置
        int i = 1;
        //当前歌曲在哪里
        int cur = 1;

        for (int j = 0; j < s.length; j++) {
            if (i == 1 && cur == 1 && s[j] == 'U'){
                cur = n;
                i = n-3;
                continue;
            }
            if (i == n-3 && cur == n && s[j] == 'D'){
                cur = 1;
                i = 1;
                continue;
            }
            if (s[j] == 'U'&& i == cur ){
                cur = cur - 1;
                i = i - 1;
                continue;
            }
            if ( s[j] == 'D' && i+3 == cur ){
                cur = cur + 1;
                i = i + 1;
                continue;
            }

            if (s[j] == 'U')
                cur = cur - 1;
            if (s[j] == 'D')
                cur = cur +1;
        }

        System.out.println(i + " "+(i+1)+" "+(i+2)+" "+(i+3));
        System.out.println(cur);
    }
    //小于等于4的方法
    private static void cursorLow(int n, char[] s) {
        //歌曲的起始位置
        int i = 1;
        //当前歌曲在哪里
        int cur = 1;

        for (int j = 0; j < s.length; j++) {
            if (cur == 1 && s[j] == 'U'){
                cur = n;
                continue;
            }
            if (cur == n && s[j] == 'D'){
                cur = 1;
                continue;
            }

            if (s[j] == 'U')
                cur = cur - 1;
            if (s[j] == 'D')
                cur = cur +1;
        }
        //当前列表
        for (int j = 0; j < n; j++) {
            if (j == 0)
                System.out.print(i);
            else
                System.out.print(" "+(i+j));
        }
        System.out.println();
        //被选中歌曲
        System.out.println(cur);
    }


    //洗牌

}
